package com.module.base.widget.layoutmanager;

import android.content.Context;
import android.util.AttributeSet;

import androidx.recyclerview.widget.LinearLayoutManager;

public class NoScrollLayoutManager extends LinearLayoutManager {

    private boolean isNoScroll;

    public NoScrollLayoutManager(Context context) {
        super(context);
    }

    public NoScrollLayoutManager(Context context, int orientation, boolean reverseLayout) {
        super(context, orientation, reverseLayout);
    }

    public NoScrollLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public boolean canScrollHorizontally() {
        if (isNoScroll){
            return false;
        }
        return super.canScrollHorizontally();
    }

    public boolean isNoScroll() {
        return isNoScroll;
    }

    @Override
    public boolean canScrollVertically() {
        if (isNoScroll){
            return false;
        }
        return super.canScrollVertically();
    }

    public void setNoScroll(boolean noScroll) {
        isNoScroll = noScroll;
    }
}
